#include "Common.hpp"
#include <execinfo.h>
#include <cstdio>


namespace tcplib
{

void panic(const char *msg)
{
    fprintf(stderr, "%s\n", msg);

    const int len = 200;
    void* buffer[len];
    int nptrs = ::backtrace(buffer, len);
    char** strings = ::backtrace_symbols(buffer, nptrs);
    if (strings) {
        for (int i = 0; i < nptrs; ++i) {
            fprintf(stderr, "%s\n", strings[i]);
        }
        free(strings);
    }
    abort();
}



};

